package com.moxi.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.moxi.model.Admin;
import com.moxi.service.AdminService;


@RestController
@RequestMapping("/admin")
public class AdminController {
	@Autowired
    private AdminService service;

  @RequestMapping("/login")
    public Admin page1(Admin admin) {
    	Admin r = service.findByNameAndPassword(admin);
        return r;
        
    }
    
    
    @GetMapping("/login")
    public String login(Model model) {
    	model.addAttribute("projectName","MOXI");
		return "login";
		}
    
    @GetMapping("/register")
   public String register(Model model) {
	   model.addAttribute("projectName","MOXI");
	return "register";
	   
   }
}
